<template>
  <a-modal title='申请退货通知单(整单退货)' v-model='visible' :dialog-style="{ top: '10px' }" v-if='visible' width='650px' height='400px' @cancel='this.visible = false' @ok='handleSubmit'>
    <a-alert message='部分商品退货请进入订单详情页面操作退货申请' style='margin-bottom: 20px' />
    <f-form ref='backForm' :action='api.hyOrderDetails.backByOrderId' v-if='visible' :form-key='this.formItem.orderDetailsId'>
      <f-form-item label='退货原因' name='reason'  required />
    </f-form>
  </a-modal>
</template>
<script>
import api from "../../js/api"

export default {
  name: "BackOrderModal",
  props: {},
  data() {
    return {
      refs: this.$refs,
      api: Object.assign(api, this.api),
      loading: false,
      visible: false,
      reason: [{ label: "滞销", value: "滞销" }, { label: "价高", value: "价高" }, { label: "召回", value: "召回" }, { label: "追回", value: "追回" }, { label: "销售退回补价", value: "销售退回补价" }],
      formItem: this.getFormItem(),
      queryParam: {}
    }
  },
  watch: {},
  methods: {
    getFormItem() {
      return {
        orderId: "",
        reason: ""
      }
    },
    open(record) {
      if (record) {
        this.formItem = record
      }
      this.visible = true
    },
    handleSubmit() {
      let params = {
        orderId: this.formItem.orderId,
        reason: this.formItem.reason
      }
      this.$refs["backForm"].submit(params, () => {
        this.$emit("success")
        this.visible = false
      })
    }
  },
  created() {
  },
  components: {}
}
</script>

<style scoped lang='less' rel='stylesheet/less'>

</style>
